import {
  BwComPropSetConstValueComEnum,
  BwCustomComPropDataTypeEnum,
  BwCustomComEmitParamDataTypeEnum,
  BwCustomComSoltTypeEnum,
} from '../../../render/models'
import type {
  BwCustomComEmitInfoModel,
  BwCustomComSlotInfoModel,
  BwCustomComPropInfoModel,
} from '../../../render/models'

/** 组件属性 */
const comAttrs: Array<BwCustomComPropInfoModel> = [
  {
    key: 'class',
    name: 'classNames',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.array,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'open',
    name: '弹窗是否可见	',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: 'open(v-model)',
    isModel: true,
  },
  {
    key: 'title',
    name: '弹窗标题',
    isRequire: false,
    defaultValue: '弹窗标题',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'width',
    name: '弹窗宽度',
    isRequire: false,
    defaultValue: '520',
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.number,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.number,
    constValueSetCom: BwComPropSetConstValueComEnum.number,
    constValueSetComProps: JSON.stringify({
      min: 0,
    }),
    remark: '',
  },
  {
    key: 'wrapClassName',
    name: '弹窗外层容器的类名',
    isRequire: false,
    defaultValue: '',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'zIndex',
    name: '弹窗层级',
    isRequire: false,
    defaultValue: '1000',
    dataType: [BwCustomComPropDataTypeEnum.number],
    defaultValueDataType: BwCustomComPropDataTypeEnum.number,
    constValueSetCom: BwComPropSetConstValueComEnum.number,
    constValueSetComProps: JSON.stringify({
      min: 0,
    }),
    remark: '',
  },
  {
    key: 'okText',
    name: '确认按钮文字',
    isRequire: false,
    defaultValue: '确定',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'okType',
    name: '确认按钮类型',
    isRequire: false,
    defaultValue: 'primary',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        { label: '默认按钮', value: 'default' },
        { label: '主要按钮', value: 'primary' },
        { label: '幽灵按钮', value: 'ghost' },
        { label: '虚线按钮', value: 'dashed' },
        { label: '链接按钮', value: 'link' },
        { label: '文字按钮', value: 'text' },
      ],
    }),
    remark: '',
  },
  {
    key: 'confirmLoading',
    name: '确定按钮 loading',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'cancelText',
    name: '取消按钮文字',
    isRequire: false,
    defaultValue: '取消',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'cancelButtonProps',
    name: '取消按钮配置',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'closable',
    name: '是否显示关闭图标按钮',
    isRequire: false,
    defaultValue: 'true',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'mask',
    name: '是否展示遮罩',
    isRequire: false,
    defaultValue: 'true',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'maskClosable',
    name: '点击蒙层是否允许关闭',
    isRequire: false,
    defaultValue: 'true',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'maskStyle',
    name: '遮罩蒙层样式',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'keyboard',
    name: '是否支持键盘 esc 关闭',
    isRequire: false,
    defaultValue: 'true',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'destroyOnClose',
    name: '关闭时是否销毁子元素',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'centered',
    name: '垂直居中展示弹窗',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'bodyStyle',
    name: '弹窗内容样式',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
]

/** 组件事件 */
const comEmits: Array<BwCustomComEmitInfoModel> = [
  {
    key: 'update:open',
    name: '对话框是否可见',
    isModel: true,
    params: [
      {
        paramKey: 'open',
        paramName: '绑定值',
        paramDataType: BwCustomComEmitParamDataTypeEnum.string,
        remark: '',
      },
    ],
  },
  {
    key: 'cancel',
    name: '弹窗关闭',
    params: [
      {
        paramKey: 'e',
        paramName: 'e',
        paramDataType: BwCustomComEmitParamDataTypeEnum.object,
        remark: '',
      },
    ],
  },
  {
    key: 'ok',
    name: '点击确定回调',
    params: [
      {
        paramKey: 'e',
        paramName: 'e',
        paramDataType: BwCustomComEmitParamDataTypeEnum.object,
        remark: '',
      },
    ],
  },
]

/** 组件插槽 */
const comSlots: Array<BwCustomComSlotInfoModel> = [
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'default',
      slotName: '内容插槽',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'footer',
      slotName: '底部插槽',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'closeIcon',
      slotName: '关闭图标插槽',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'title',
      slotName: '标题插槽',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'okText',
      slotName: '确认按钮',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'cancelText',
      slotName: '取消按钮',
    },
  },
]

export const antModalInfo = {
  comAttrs,
  comEmits,
  comSlots,
}
